package com.example.qundui.learndemo;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.facebook.drawee.view.SimpleDraweeView;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.recker.flybanner.FlyBanner;
import com.squareup.picasso.Picasso;

import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by qundui on 2017/4/22.
 */

public class Pictest extends Activity {
   private ImageView iv;
//     private FlyBanner fy;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pic_test);
//        fy= (FlyBanner) findViewById(R.id.banner_1);
//        initNetBanner();

    }
    public void getPic(View view){
        String url="https://bmc.huochexia.com/qundui-manager/userfiles/9a29fe156da64c66adf862f912f0eeaf/images/banner/2016/12/QQ图片20161219175344.png";
            String url2="https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1493185170&di=e040d91aebeeeab8a0746c000f34c1d4&src=http://img27.51tietu.net/pic/2017-011500/20170115001256mo4qcbhixee164299.jpg";
        iv= (ImageView) findViewById(R.id.iv);
       // x.image().bind(iv,url);

//        Picasso.with(this).setLoggingEnabled(true);
//        Picasso.with(this).load(url).into(iv);
        //PicassoUtils.loadImageByurl(url,this,iv);
        //ImageLoader.getInstance().displayImage(url,iv);


//        SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view);
//        draweeView.setImageURI(url);
    Glide.with(this).load(url).into(iv);
//        PicassoUtils.loadImageByurl("https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1493185170&di=e040d91aebeeeab8a0746c000f34c1d4&src=http://img27.51tietu.net/pic/2017-011500/20170115001256mo4qcbhixee164299.jpg",this,iv);


    }
    /**
     * 加载网页图片
     */
    private void initNetBanner() {
        List<String> imgesUrl = new ArrayList<>();
        imgesUrl.add("https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1493185170&di=e040d91aebeeeab8a0746c000f34c1d4&src=http://img27.51tietu.net/pic/2017-011500/20170115001256mo4qcbhixee164299.jpg");
        imgesUrl.add("http://img5.imgtn.bdimg.com/it/u=3814375171,3829115000&fm=11&gp=0.jpg");
        imgesUrl.add("http://pic.58pic.com/58pic/13/61/00/61a58PICtPr_1024.jpg");
//        fy.setImagesUrl(imgesUrl);
//        fy.setOnItemClickListener(new FlyBanner.OnItemClickListener() {
//            @Override
//            public void onItemClick(int position) {
//                toast("点击了第" + position + "张图片");
//            }
//        });
    }

    private void toast(String s) {
        Toast.makeText(this,s,0).show();
    }
}
